import 'package:json_annotation/json_annotation.dart';

part 'result_base.g.dart';

/// @Author lixiaobin
/// @Date 2023/11/2
/// @Description
@JsonSerializable(genericArgumentFactories: true)
class ResultBase<T> {
  /// 请求状态code
  int? responseCode;

  /// 数据封装对象
  T? responseBody;

  /// 请求msg
  String? responseMsg;

  /// 分页
  int? pageIndex;

  /// 每页数量
  int? pageSize;

  /// 总数
  int? count;

  ResultBase();

  factory ResultBase.fromJson(
    Map<String, dynamic> json,
    T Function(dynamic json) fromJsonT,
  ) =>
      _$ResultBaseFromJson<T>(json, fromJsonT);

  Map<String, dynamic> toJson(Object? Function(T value) toJsonT) =>
      _$ResultBaseToJson<T>(this, toJsonT);
}

class BaseModel{
  BaseModel();
  BaseModel? fromJson(Map<String, dynamic> srcJson){
    return null;
  }
}
